# coding:utf-8

import os
import sys
import copy
import timeit
import threading
import time
import chardet
import cv2 as cv
import numpy
import matplotlib.pyplot as plt

print cv.__version__
img = numpy.array([])
img = cv.imread("f:/cubiod.png")
print type(img)

a = numpy.array(bytearray("fewew"))
print a
print [1, 1, 1, "mm"]

s = "中文"
u = s.decode('utf-8')
print sys.getdefaultencoding()
print u
print isinstance(u, unicode)
gbk = u.encode('gb2312')
print gbk.decode('gb2312')
print "\\x%x\\x%x\\x%x\\x%x" % (bytearray(gbk)[0], bytearray(gbk)[1], bytearray(gbk)[2], bytearray(gbk)[3])

cap = cv.VideoCapture("xxx.avi")
print type(cap)
cap.release()

if isinstance(img, numpy.ndarray):
    print img.shape
    cv.imshow("org image", img)
    cv.waitKey(0)

plt.title("title")
plt.xlabel("x-axis")
plt.ylabel("y-axis")
plt.plot([1, 2, 3, 4], "or")
plt.show()
